package com.cn.qtms.common.codename;//类注释设置模板

import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * @Name:CodeNameItemConvertor
 * @Description:
 * @Author: zhangyang
 * @Date: 2019-08-08 23:37
 **/
public class CodeNameItemConvertor<T> {
    private List<T> list;

    public CodeNameItemConvertor(List<T> list) {
        this.list = list;
    }

    public <U> List<U> map(Function<? super T, ? extends U> converter) {
        if (list == null){
            return null;
        }
        return list.stream().map(converter::apply).collect(Collectors.toList());
    }

}
